package poo.recursion;

public class Permuta {
	
	private static int c=0;

	public static void permuta(int[] a, int i) {
		if (i == a.length - 1){
			c++;
			System.out.println(java.util.Arrays.toString(a)+" "+"combinazione num:"+c);
		}else {
			for (int j = i; j < a.length; j++) {
				int park = a[i];
				a[i] = a[j];
				a[j] = park;
				permuta(a, i + 1);
				park = a[i];
				a[i] = a[j];
				a[j] = park;
			}
		}
	}

	public static void main(String[] args) {
		int n = 10;
		int v[] = new int[n];
		for (int i = 0; i < n; i++)
			v[i] = i+1;
		permuta(v, 0);

	}

}
